package buaa.qel.rpc.test.jmeter;

import buaa.qel.rpc.client.core.RpcClient;
import buaa.qel.rpc.test.testRpc.service.HelloService;
import buaa.qel.rpc.test.testRpc.service.NQueenService;
import buaa.qel.rpc.test.testRpc.service.Person;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class JmeterTest01 {
    private final RpcClient rpcClient = new RpcClient("192.168.108.131:2181");

    @ResponseBody
    @RequestMapping("/JmeterTest01/test01")
    public boolean test01(){
        HelloService helloService = rpcClient.createService(HelloService.class, "helloServiceImpl");
        String r1 = helloService.hello("zhangsan");
        String r2 = helloService.hello(new Person("sparrow","jack"));
        String r3 = helloService.hello("lisi",1998);
        System.out.println(r1);
        System.out.println(r2);
        System.out.println(r3);
        return true;
    }

    @ResponseBody
    @RequestMapping("/JmeterTest01/test02")
    public boolean test02(){
        NQueenService nQueenService = rpcClient.createService(NQueenService.class,"NQueenServiceImpl");
        System.out.println(nQueenService.NQueen(13));
        return true;
    }
}
